GUI Help > Menus > addMenuItem

addMenuItem
addMenuItem handle menu, str caption, int returnValue

Description:
Adds an item to a menu created with createMenu, createSubMenu or createPopupMenu. When the user selects the item from the menu, a MENU_CLICK message is sent to the window which owns the menu, and eventData() contains the menu item id (taken from the returnValue parameter ^ )

Return Value:


Parameters:
menu Handle to a menu
caption The text of the menu item
returnValue A number which identifies the new item. The number which will appear in eventData() when the menu item is selected. Use this to identify which menu item has been clicked. You also need to pass this number to the setMenuItemEnabled, setMenuItemChecked etc. commands to change the item.

You should use a different number for all menu items in your application, regardless of which menus they belong to.
Remarks:


See Also:


Example:
(Note: You will need to include the GUI constants file for this example to work)